package lib

type CommonStruct struct {
	SysStruct
	ConvertStruct
	RandStruct
	TimeStruct
}

var Common = CommonStruct{
	Sys,
	Convert,
	Rand,
	Time,
}

// InMap 判断元素是否在map中
func InMap(key string, data map[string]any) bool {
	_, ok := data[key]
	return ok
}

// InMapString2Int32 判断元素是否在map中
func InMapString2Int32(key string, data map[string]int32) bool {
	_, ok := data[key]
	return ok
}

// InSliceString 判断元素是否在string类型的切片中
func InSliceString(key string, data []string) bool {
	for _, val := range data {
		if val == key {
			return true
		}
	}

	return false
}

// InSliceInt64 判断元素是否在int64类型的切片中
func InSliceInt64(key int64, data []int64) bool {
	for _, val := range data {
		if val == key {
			return true
		}
	}

	return false
}

// InSliceInt32 判断元素是否在int32类型的切片中
func InSliceInt32(key int32, data []int32) bool {
	for _, val := range data {
		if val == key {
			return true
		}
	}

	return false
}
